package com.cqndt.disaster.device.service.impl;

import java.util.*;
import java.io.File;
import com.cqndt.disaster.device.dao.*;
import org.springframework.stereotype.Service;
import com.cqndt.disaster.device.vo.TabBasicVo;
import com.cqndt.disaster.device.vo.TabHumanVo;
import com.cqndt.disaster.device.domain.TabBasic;
import com.cqndt.disaster.device.service.TabBasicService;
import com.cqndt.disaster.device.domain.TabBasicWithBLOBs;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.beans.factory.annotation.Autowired;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

/**
 * @author lgb
 * @date 2020-8-6
 * @说明 灾害点
 **/
@Service
public class TabBasicServiceImpl extends ServiceImpl<TabBasicMapper,TabBasic>
		implements TabBasicService {
	
	@Value("${file-ip}")
    private String fileIp;
 
    @Autowired
    private TabBasicMapper tabBasicMapper;
    @Autowired
    private TabHumanMapper tabHumanMapper;
    @Override
    public TabBasicVo selectTabBasicById(Integer id) {
        return tabBasicMapper.selectTabBasicById(id);
    }
    
    @Override
    public List<TabBasicVo> selectTabBasic(TabBasicVo tabBasic) {
        return tabBasicMapper.selectTabBasic(tabBasic);
    }
    @Override
    public TabBasicWithBLOBs selectById(Integer id){
        return tabBasicMapper.selectByPrimaryKey(id);
    }
    @Override
    public List<TabHumanVo> selectHumanByDisNo(String disNo){
        List<TabHumanVo> humanList = tabHumanMapper.selectByDisNo(disNo);
        for (TabHumanVo human:humanList) {
            human.setHeadUrl(fileIp+File.separator+"img"+File.separator+human.getHeadUrl());
        }
        return humanList;
    }
}